package sk.openit.java.io.dir;

import java.io.File;

public class CreateDir {

	public static void listDir(String dirName, int prefix) {
		File dir = new File(dirName);
		String[] list = dir.list();
		for (int i = 0; i < list.length; i++) {
			File subdir = new File(dirName + "\\" + list[i]);
			if (subdir.isDirectory()) {
				System.out.println(list[i]);
				for (int j = 0; j < prefix; j++) {
					System.out.print(" ");
				}
				listDir(dirName + "\\" + list[i], prefix++);
			}
		}
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// File dir = new File("c:\\Program Files");
		// File dir2 = new File("c:\\skolenie2");
		// System.out.println(dir.mkdir());
		// System.out.println(dir.renameTo(dir2));
		// dir.delete();
		listDir("c:\\Jaspi", 0);
	}

}
